<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>头部</title>
		<link rel="stylesheet" href="../css/head.css" />
	</head>
	<body>
		<!--头部1-->
		<div class="r-top1">
			<div class="r-content">
				<div class="r-left">
					<span>所在城市:</span>
					<span>郑州市</span>
					<span class="r-logol">
						<img src="../img/main/7.png" alt="" />
					</span>
				</div>
				<div class="r-right">
					<a href="###" class="r-span1 r-span11">登录</a>
					<a href="register.html" class="r-span1  r-span12">注册</a>
					<a href="###" class="r-span1">我的订单</a>
					<a href="###" class="r-span1">我的消息</a>
					<a href="###" class="r-span1">我是商家</a>
					<span class="r-span2">
						<img src="../img/main/5.png" alt="" />
					</span>
				</div>
			</div>
		</div>
		<!--头部2-->
		<div class="r-top2">
			<div class="r-left1">
				<a href="main.html"><img src="../img/main/1.png" alt="" /></a>
			</div>
			<div class="r-middle1">
				<div class="r-search">
					<input type="text" placeholder="请输入关键字进行搜索" />
					<span class="r-span3">
        	   	<img src="../img/main/8.png" alt="" />
        	   	</div>
        	   	<div class="r-middle-foot">
        	   		<span class="r-middle-foot1">热门:</span>
					<span class="r-middle-foot1">奇异果</span>
					<span class="r-middle-foot1">牛排</span>
					<span class="r-middle-foot1">山竹</span>
					<span class="r-middle-foot1">餐饮</span>
					<span class="r-middle-foot1">休闲</span>
					<span class="r-middle-foot1">电影</span>
				</div>

				</span>
			</div>
			<div class="r-right1">
				<div class="r-person1 r-dolor">
					<img src="../img/main/3.png" alt="" />
					<a href="personalbusiness.html"><span>个人中心</span></a>
				</div>
				<div class="r-car1  r-dolor">
					<img src="../img/main/6.png" alt="" />
					<img src="../img/main/dhk.png" alt="" class="r-img1" />
					<p class="r-p1">5</p>
					<a href="###"><span>购物车</span></a>
				</div>
			</div>

		</div>

	</body>
	<!--	<script src="../js/head.js" type="text/javascript" charset="utf-8"></script>-->
	<script type="text/javascript">
		
	//点击热门搜索时内容会到输入框
	$(".r-middle-foot1").each(function(i,e){
		$(e).click(function(){
			console.log($(e).text());
			$(".r-middle1 input").val($(e).text());
		})
	})
	
	$(".r-search").click(function(){
		window.location="#/sameCity/"+$(".r-middle1 input").val();
	})
		
		
		//头部个人中心,购物车
		//跳转到购物车
		var login = true;
		var carState = false; //登录状态
//		$scope.carState = function() {
//			//首先判断是否登录
//			if($scope.login == true) {
//				$scope.var1 = true;
//			} else {
//				$scope.var1 = false;
//			}
//		}
		
		if( login==true){
			$('.r-span11').html('你好,'+localStorage.tel);
			carState = true;
			login=false;
			$('.r-span12').html('退出');
			$('.r-span12').click(function(){
				window.location = "#/main";
			})
		}else{
			$('.r-span11').html('登录');
			$('.r-span12').html('注册');
			carState = false;
			$('.r-span12').click(function(){
				window.location.href = "register.html";
			})
		}
		$('.r-car1').click(function(){
			if(carState == true){
				$(this).find('a').attr('href','shopcar.html');
			}else{
				$(this).find('a').attr('href','shopcar.html');
			}
		})
	
		//个人中心,
		$('.r-person1').click(function(){
			if(login==true){
				console.log(112)
				$(this).find('a').attr('href','personalbusiness.html')
			}else{
				$(this).removeAttr('href');
			}
		})
	</script>

</html>